from datetime import datetime
from multiprocessing.pool import Pool
import requests


# li = [{'username': '13853275090', 'password': 'wzg159753'}, {'username': '17616273857', 'password': 'wzg159753'}, {'username': '15904582784', 'password': 'asdf1123'}, {'username': '13438493620', 'password': 'asdf1123'}, {'username': '13404502058', 'password': 'asdf1123'}, {'username': '15043614814', 'password': 'asdf1123'}]
#
# for data in li:
#     result = requests.get(f'http://127.0.0.1:9057/spider/login/?username={data.get("username")}&password={data.get("password")}')
#     print(result)
import time

headers = {
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.86 Safari/537.36',
    'Cookie': 'ssuid=5385309444; TYCID=646c8f80a2b411e9b364ff90ae1b0927; undefined=646c8f80a2b411e9b364ff90ae1b0927; _ga=GA1.2.474310100.1562723129; aliyungf_tc=AQAAAKe4CEEcRAkA2mGDfBfSXQjCPFWa; csrfToken=23AViI-vOfL0VYeJr8yEHuSQ; Hm_lvt_e92c8d65d92d534b0fc290df538b4758=1563441215,1563502650,1563507065,1563860022; _gid=GA1.2.2001517937.1563860022; bannerFlag=true; token=70b5fe59b7fb4fe8a42185c763e15ddb; _utm=8eaf7e55a26b405c97a04479c52b4dcf; _gat_gtag_UA_123487620_1=1; tyc-user-info=%257B%2522claimEditPoint%2522%253A%25220%2522%252C%2522myAnswerCount%2522%253A%25220%2522%252C%2522myQuestionCount%2522%253A%25220%2522%252C%2522signUp%2522%253A%25220%2522%252C%2522explainPoint%2522%253A%25220%2522%252C%2522privateMessagePointWeb%2522%253A%25220%2522%252C%2522nickname%2522%253A%2522%25E5%2585%258B%25E9%2587%258C%25E6%2596%25AF%25E8%2592%2582%25E5%25A8%259C%25C2%25B7%25E8%2589%25BE%25E4%25BC%25AF%25E7%259B%2596%25E7%2589%25B9%2522%252C%2522integrity%2522%253A%25220%2525%2522%252C%2522privateMessagePoint%2522%253A%25220%2522%252C%2522state%2522%253A%25220%2522%252C%2522announcementPoint%2522%253A%25220%2522%252C%2522isClaim%2522%253A%25220%2522%252C%2522vipManager%2522%253A%25220%2522%252C%2522discussCommendCount%2522%253A%25221%2522%252C%2522monitorUnreadCount%2522%253A%25228%2522%252C%2522onum%2522%253A%25220%2522%252C%2522claimPoint%2522%253A%25220%2522%252C%2522token%2522%253A%2522eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiIxMzg1MzI3NTA5MCIsImlhdCI6MTU2Mzg3MDI0NCwiZXhwIjoxNTk1NDA2MjQ0fQ.XpepuAf1uem4g12WfCfUWL_LnG8f2XaRnKO9xB5Br_DSvDmniu7MacV2ERVJgTX2gmjfu18Ded_uEQDXt67s1A%2522%252C%2522pleaseAnswerCount%2522%253A%25220%2522%252C%2522redPoint%2522%253A%25220%2522%252C%2522bizCardUnread%2522%253A%25220%2522%252C%2522vnum%2522%253A%25220%2522%252C%2522mobile%2522%253A%252213853275090%2522%257D; auth_token=eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiIxMzg1MzI3NTA5MCIsImlhdCI6MTU2Mzg3MDI0NCwiZXhwIjoxNTk1NDA2MjQ0fQ.XpepuAf1uem4g12WfCfUWL_LnG8f2XaRnKO9xB5Br_DSvDmniu7MacV2ERVJgTX2gmjfu18Ded_uEQDXt67s1A; RTYCID=83f662c7ecca49f99c1fbd8400e60490; Hm_lpvt_e92c8d65d92d534b0fc290df538b4758=1563870251; CT_TYCID=cc3a925f0d52401f9245abda94566a36; cloud_token=cb4ef3df4b264c5e9bd95e4938c4c5b7; cloud_utm=fc2e144ca1f64fbfafa63bdbed7e40cc'
}
# a = datetime.now()
# print(a)
# for i in range(40):
#     resp = requests.get('https://www.tianyancha.com/company/2349015448', headers=headers)
#     print(resp.text)
#
# b = datetime.now()
# print(b)
# print(b-a)


def func():
    resp = requests.get('https://www.tianyancha.com/company/2349015448', headers=headers)
    print(resp.text)

if __name__ == '__main__':
    pool = Pool(10)
    for _ in range(40):
        pool.apply_async(func=func)
    pool.close()
    pool.join()